{% extends "../base_adminlte.html" %}
{% load staticfiles %}
{% load widget_tweaks  %}
{% block content %}
<div class="content-wrapper">
  <!-- Content Header (Page header) -->
    <div class="content-header">
    </div>
  <section class="content">
  <form action="" role="search" method="get">
             <div class="input-group col-md-12">
        {% with form=filter.form %}
                {% for field in form.visible_fields %}
        <div class="form-group col-sm-4 col-md-4">
        {{ field.label_tag }}
                      {% render_field field  %}
        </div>
        {% endfor %}
        {% endwith %}
    </div>
              <button    type="submit" class="btn btn-primary" id="btn_add" data-toggle="modal"
                     data-target="#addModal" >查询</button>
        {% if perms.public.playbook_manage %}
          <label>
      <button  type="button" class="btn btn-primary" id="btn_add" data-toggle="modal"
                     data-target="#addModal" onclick="location='{% url 'ansibleroleadd' %}'">新增ansiblerole</button>
          </label>
      {% endif %}
      </form>

      <table class="table table-bordered">
      <tr style="font-weight: bold;background-color: #3c8dbc80;">
          <td align="center" style="white-space:nowrap;">ansiblerole名称</td>
          <td align="center" style="white-space:nowrap;">描述</td>
          <td align="center" style="white-space:nowrap;">ansiblerole状态</td>
          <td align="center" style="white-space:nowrap;">更新时间</td>
          <td align="center" style="white-space:nowrap;">管理</td></tr>
      {% for h in page_obj %}
          <tr style="background-color: #e4e6e8">
            <td style="white-space:nowrap;vertical-align:middle;">{{ h.ansiblerole }}</td>
              <td style="vertical-align:middle;">{{ h.remark }}</td>
              <td style="vertical-align:middle;">{{ h.status }}</td>
              <td style="white-space:nowrap;vertical-align:middle;">{{ h.createTime }}</td>
          <td style="white-space:nowrap;vertical-align:middle;">
                {% if perms.public.playbook_manage %}
                    <button type="button" class="btn btn-warning btn-xs" onclick="location='{% url 'ansiblerolemod' %}?id={{ h.id }}'">修改</button>
                    <button type="button" class="btn btn-danger btn-xs" onclick="return del({{ h.id }});">删除</button>
              {% else %}
                    /
                {% endif %}
          </td>
          </tr>
      {% endfor %}
      </table>
   <div  style="float:right;height: 200px;font-size:15px">
                 {#  #总条数#}
            <div  style="width: 90px;height: 50px;float:left;margin: 10px 0 0 1px">总记录<label>{{ filter.qs|length }}</label>条</div>
                {#  #总页码#}
            <div  style="width: 60px;height: 50px;float:left;margin: 10px 0 0 1px">共<label>{{ total }}</label>页</div>
                {#  #当前页码#}
                {# #首页#}

               <div  style="width: 30px;height: 50px;float:left;margin: 10px 0 0 1px">
                        <p><a href="?{% param_replace page=1 %}">首页</a></p>
               </div>
                {# #前一页#}
                <div style="width: 30px;height: 50px;float:left;margin: 10px 0 0 5px">
                   {% if page_obj.has_previous %}
                     <p><a href="?{% param_replace page=page_obj.previous_page_number %}">{{ page_obj.previous_page_number }}</a> </p>
                    {% endif %}
               </div>
                {##当前页页码#}
               <div  style="width: 30px;height: 50px;float:left;margin: 10px 0 0 1px">
                   <p> {{ page_obj.number }}</p>

               </div>
                {# #后一页#}
               <div style="width: 30px;height: 50px;float:left;margin: 10px 0 0 1px">
               {% if page_obj.has_next %}
                   <p><a href="?{% param_replace page=page_obj.next_page_number %}">{{ page_obj.next_page_number }}</a></p>
                {% endif %}
               </div>
                {##尾页#}
                 <div  style="width: 30px;height: 50px;float:left;margin: 10px 0 0 1px">
                        <p><a href="?{% param_replace page=total %}">尾页</a> </p>
               </div>
  </div>
  </section>
</div>
{% endblock %}

{% block scriptcontent %}
<script>
    function del(a){
             if(confirm("确实要删除吗?")){
                 alert("已经删除！");
                 document.getElementById('')
                 location='{% url 'ansibleroledelete' %}?id='+a+''
            }else{
                alert("已经取消了删除操作");
             }
         }
</script>
{% endblock %}
